package com.soft.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.soft.entity.TeamDefaultPermission;

@Mapper
public interface TeamDefaultPermissionMapper extends BaseMapper<TeamDefaultPermission> {
    
    @Select("SELECT * FROM team_default_permission WHERE team_id = #{teamId}")
    List<TeamDefaultPermission> selectByTeamId(Integer teamId);
    
    @Update("DELETE FROM team_default_permission WHERE team_id = #{teamId}")
    int deleteByTeamId(Integer teamId);
    
    @Select("SELECT COUNT(*) > 0 FROM team_default_permission " +
            "WHERE team_id = #{teamId} " +
            "AND resource_type = #{resourceType} " +
            "AND action = #{action}")
    boolean checkPermission(Integer teamId, String resourceType, String action);
}
